import java.util.Arrays;
import java.util.Scanner;

/**
 * @author gao
 * @date 2025/11/10 19:18
 */

public class Solution {
    public int[] sortArrayByParity(int[] nums) {
        for (int cur = 0, dest = -1; cur < nums.length; cur++) {
            if (isEven(nums[cur])) {
                dest++;
                int tmp = nums[cur];
                nums[cur] = nums[dest];
                nums[dest] = tmp;
            }
        }
        return nums;
    }

    private boolean isEven(int n) {
        return n % 2 == 0;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNext()) {
            int n = in.nextInt();
            int[] nums = new int[n];
            for (int i = 0; i < n; i++) {
                nums[i] = in.nextInt();
            }
            Solution solution = new Solution();
            System.out.println(Arrays.toString(solution.sortArrayByParity(nums)));
        }
    }
}